<!-- 数据信息 -->
<template>
  <div id="dialog-container">
    <el-button type="primary" plain @click="dialogVisible = true">数据信息</el-button>
    <el-dialog v-dialogDrag title="数据信息" append-to-body :visible.sync="dialogVisible"
    :before-close="handleClose" width="760px" :close-on-click-modal="false">
      <el-button type="primary" plain  @click="getExcel()">导出</el-button>
      <div style="text-align: center;font-size: 15px;">
        {{data.fieldName}}检测项目统计<br><br>{{data.fromDate}}~{{data.toDate}}
      </div>
      <hr>
      <el-form :model="form" :inline="true" label-width="80px" size="small">
        <el-row>
          <el-col :span="12">
            <el-form-item label="零件号：">
              <!-- <el-input v-model="data.name" dis></el-input> -->{{data.partNumber}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="零件名称：">
              <!-- <el-input v-model="form.name"></el-input> -->{{data.partName}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="零件图号：">
              <!-- <el-input v-model="form.name"></el-input> -->{{data.partGraphNumber}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="图纸版本：">
              <!-- <el-input v-model="form.name"></el-input> -->{{data.graphVersion}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="检测项目：">
              <!-- <el-input v-model="form.name"></el-input> -->{{data.fieldName}}
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-table :data="data.dataList" border size="">
        <el-table-column prop="heatingNumber" align="center" label="热处理炉号" min-width="100"></el-table-column>
        <el-table-column prop="materialFurnanceNumber" align="center" label="原材料炉号" min-width="100"></el-table-column>
        <el-table-column prop="act1" align="center" label="实测值1" min-width="100"></el-table-column>
        <el-table-column prop="act2" align="center" label="实测值2" min-width="100"></el-table-column>
        <el-table-column prop="act3" align="center" label="实测值3" min-width="100"></el-table-column>
        <!-- <el-table-column prop="avgData" align="center" label="平均值" min-width="100"></el-table-column> -->
        <el-table-column prop="avgData" align="center" label="显示值" min-width="100"></el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="dialogVisible = false">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    props:['data',
    'testType',
    'fieldId',
    'partId',
    'materialFurnanceNumber',
    'fromDate',
    'toDate'],
    data() {
      return {
        dialogVisible: false,
        form: {
          name: ''
        },
        tableData: [{
          date: '2016-05-02',
          name: '王小虎',
          address: ' 1518 弄'
        }, {
          date: '2016-05-04',
          name: '王小虎',
          address: ' 1517 弄'
        }, {
          date: '2016-05-01',
          name: '王小虎',
          address: ' 1519 弄'
        }]
      }
    },
    methods: {
      
      getExcel() {
        window.location.href= `${process.env.API_URL}` + "report/findByPartNumExcel?testType="+this.testType+
          "&fieldId="+this.fieldId +"&partId="+ this.partId +"&materialFurnanceNumber="+this.materialFurnanceNumber+
          "&fromDate="+ this.fromDate +"&toDate="+this.toDate+"&fieldName="+this.data.fieldName+ "&graphVersion="+this.data.graphVersion+
          "&partNumber="+this.data.partNumber + "&partName="+this.data.partName + "&partGraphNumber="+this.data.partGraphNumber;
      },
      handleClose() { /* 关闭的时候更新状态值 */
        this.dialogVisible = false;
      }
    }
  }

</script>
